package java_test.io_test;

import java.io.File;

public class FileTest {
    public static void main(String[] args) {
        String dirname = "https://blog.csdn.net/qq_46365857/article/details/106846930";
        File f1 = new File(dirname);
        System.out.println(f1.getName() + "123123");
        if (f1.isDirectory()) {
            // 测试此抽象路径名表示的文件是否是一个目录
            System.out.println("目录名称是" + dirname);
            String s[] = f1.list();
            for (int i = 0; i < s.length; i++) {
                File f = new File(dirname + "/" + s[i]);

                if (f.isDirectory()) {
                    System.out.println(s[i] + " 是文件夹");
                } else {
                    System.out.println(s[i] + " 是文件");
                }
            }
        } else {
            System.out.println(dirname + " 不是一个文件夹");
        }
    }
}
